<include file="Public/header"/>
<div class="row">
  <div class="col-sm-12">
    <div class="ibox-content">
    <form class="layui-form" action="" id="profile">
      <input type="hidden" name="userid" value="<{$u.id}>">
      <input type="hidden" name="salt" value="<{$u.salt}>">
      <input type="hidden" name="groupid" value="<{$u.groupid}>">
      <div class="layui-form-item">
        <label class="layui-form-label">登录密码：</label>
        <div class="layui-input-inline">
          <input type="text" name="u[password]" autocomplete="off" value="" placeholder="修改登录密码" class="layui-input">
        </div>
        <div class="layui-form-mid layui-word-aux">不修改密码，请留空.</div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">支付密码：</label>
        <div class="layui-input-inline">
          <input type="text" name="u[paypassword]" lay-verify="" autocomplete="off" value="" placeholder="修改支付密码" class="layui-input">
        </div>
        <div class="layui-form-mid layui-word-aux">不修改密码，请留空.</div>
      </div>
      <div class="layui-form-item">
        <div class="layui-input-block">
          <button class="layui-btn" lay-submit="submit" lay-filter="save">提交保存</button>
        </div>
      </div>
    </form>
    </div>
  </div>
</div>
<include file="Public/footer"/>
<script>
    layui.use(['layer', 'form','laydate'], function(){
        var form = layui.form
            ,laydate = layui.laydate
            ,layer = layui.layer;

        //监听提交
        form.on('submit(save)', function(data){
            $.ajax({
                url:"<{:U('User/editPassword')}>",
                type:"post",
                data:$('#profile').serialize(),
                success:function(res){
                    if(res.status){
                        layer.alert("编辑成功", {icon: 6},function () {
                            parent.location.reload();
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.layer.close(index);
                        });
                    }else{
                        layer.alert("操作失败", {icon: 5},function () {
                            parent.location.reload();
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.layer.close(index);
                        });
                    }
                }
            });
            return false;
        });
    });
</script>
<!--统计代码，可删除-->
</body>
</html>